package com.shop.dingdongshoppingapi.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import com.shop.dingdongshoppingapi.dao.ClassifyDao;
import com.shop.dingdongshoppingapi.dto.ShopCarAddDto;
import com.shop.dingdongshoppingapi.dto.ClassifyDto;
import com.shop.dingdongshoppingapi.entity.Goods;
import com.shop.dingdongshoppingapi.entity.ShopCar;
import com.shop.dingdongshoppingapi.service.intf.ClassifyService;

import com.shop.dingdongshoppingapi.vo.R;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Author:小樊
 *
 * @Date:2022/7/2 9:13
 */
@Service
public class ClassifyServiceImpl implements ClassifyService {
    @Resource
    private ClassifyDao dao;
    //查询所有商品
    @Override
    public R all(Integer token) {

        return R.ok( dao.selectAll());
    }



    @Override
    public R selectLike(String gname) {
        if(gname!=null){
            QueryWrapper<Goods> wrapper = new QueryWrapper<>();
            wrapper.like("gname",gname);
            List<Goods> goods = dao.selectList(wrapper);
            return R.ok(goods);
        }
        return R.fail();
    }
}
